#ifndef I2C_HAL_H 
#define I2C_HAL_H

//-- Includes -----------------------------------------------------------------
#include "system.h"
#include "delay.h"
//-- Enumerations -------------------------------------------------------------

// I2C acknowledge
typedef enum{ 
    ACK	= 0,
    NACK = 1,
}etI2cAck;

//=============================================================================
void I2c_Init(void);
//=============================================================================
// Initializes the ports for I2C interface.
//-----------------------------------------------------------------------------

//=============================================================================
void I2c_StartCondition(void);
//=============================================================================
// Writes a start condition on I2C-Bus.
//-----------------------------------------------------------------------------
// remark: Timing (delay) may have to be changed for different microcontroller.
//	 	
// SDA:	| 	
//	 	
// SCL:	| 	

//=============================================================================
void I2c_StopCondition(void);
//=============================================================================
// Writes a stop condition on I2C-Bus.
//-----------------------------------------------------------------------------
// remark: Timing (delay) may have to be changed for different microcontroller.
//	 	
// SDA:	 	|
//	 	
// SCL:	 	|

//=============================================================================
etError I2c_WriteByte(u8t txByte);
//=============================================================================
// Writes a byte to I2C-Bus and checks acknowledge.
//-----------------------------------------------------------------------------
// input:	txByte	transmit byte
 

//
// return: error:	ACK_ERROR = no acknowledgment from sensor
//	NO_ERROR	= no error
//
// remark: Timing (delay) may have to be changed for different microcontroller.

//=============================================================================
etError I2c_ReadByte(u8t *rxByte, etI2cAck ack, u8t timeout); 

etError I2c_GeneralCallReset(void);

#endif
